<template>
  <div>
    <form-create :rule="rule" v-model="fApi" :option="options" />
    <Button type="primary" @click="setForm">赋值</Button>

    {{ value }}
  </div>
</template>

<script>
export default {
  data() {
    return {
      fApi: {},
      value: null,
      options: {
        onSubmit: (formData) => {
          alert(JSON.stringify(formData));
          // alert(JSON.stringify(this.fApi))
        },
        resetBtn: true,
      },
      rule: [
        {
          type: "Dictionary",
          field: "hello",
          title: "商品名称",
            validate: [{ required: true ,message:"必填",type:"string"//,trigger:"change"
            }],
          props: {
            code: "System.DbEnityDefined.DataType",
            // type:"radio",
          },
          col: {
            span: 12,
          },
          info: "hello,tt",
        },
         {
          type: "Dictionary",
          field: "hello2",
          title: "商品名9称",
            validate: [{ required: true ,message:"必填"//,trigger:"change"
            }],
          props: {
            code: "System.DbEnityDefined.Unit",
            // type:"radio",
          },
          col: {
            span: 12,
          },
          info: "hello,tt",
        },
        {
          type: "checkbox",
          field: "label",
          title: "标签",
          options: [
            { label: "好用", value: 0 },
            { label: "快速", value: 1 },
            { label: "高效", value: 2 },
            { label: "全能", value: 3 },
          ],
        },
      ],
    };
  },
  components: {},
  methods: {
    setForm() {
      //   this.fApi.setValue({ helo: "varchar", label: [0, 1] });
      this.value = this.fApi.formData();
    },
  },
};
</script>

<style style="less">
</style>
